package org.apnprovider.ws;
import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.Namespace;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.XPathParam;
import org.apache.log4j.Logger;

/**
 * Implementation for DeviceStorage web service
 *
 * @seee org.apnprovider.DeviceStorage
 * 
 * author Alexey Palamarchuk (slonnik@gmail.com)
 *
 */
@Endpoint
public class DeviceStorageEndPoint{
	/** logger*/
	final protected Logger log = Logger.getLogger(DeviceStorageEndPoint.class);
	
	@PayloadRoot(localPart="DeviceAddRequest", namespace="http://open-apns.org/provider/schema")
	@Namespace(prefix="s", uri="http://open-apns.org/provider/schema")
	public void addDevice(@XPathParam("/s:DeviceAddRequest/ProviderKey")String key,
			@XPathParam("/s:DeviceAddRequest/DeviceToken")String token)
	{
		if(log.isDebugEnabled())
		{
			log.debug(String.format("Method 'addDevice' is called with " +
					"DeviceAddRequest{ProviderKey = \"%1$s\", DeviceToken = \"%2$s\"}",
					key, token));
		}
	}


}
